var Base = require('./Base');

class BlogPost extends Base {

    constructor() {
        super();
        super.tableName = 'blog_post';
    }

    findByOldId(oldId) {
        let sql = "select * from blog_post bp where bp.old_id = ?";
        let params = [oldId];
        return super.execute(sql, params);
    }

    saveByParams(params) {
        let sql = "insert into blog_post(title,content_html,content_markdown,summary,user_id) values (?,?,?,?,?)";
        return super.execute(sql, params);
    }

    updateByParams(params) {
        let sql = "update blog_post set title = ?,content_html=?,content_markdown=?,summary=? where id = ?";
        return super.execute(sql, params);
    }

}

module.exports = BlogPost;